package com.mjh.zhujianju.enums;

/**
 * @author liuyang
 * @Description: 办事指南枚举类型
 * @date 2018/8/14 22:19
 */
public enum  WorkGuideEnum {
    TOWN_COUNTRY("0","城乡建设"),
    HOUSING_MANAGEMENT("1","住房管理");

    private String code;
    private String name;

    public String getCode() {
        return code;
    }

    public void setCode(String code) {
        this.code = code;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    WorkGuideEnum(String code, String name) {
        this.code = code;
        this.name = name;
    }

    public static WorkGuideEnum[] getEnums(){
        return WorkGuideEnum.values();
    }

    public static String getName(String code){
        if(code == null){
            return null;
        }

        for (WorkGuideEnum workGuideEnum : WorkGuideEnum.values()){
            if(code.equals(workGuideEnum.getCode())){
                return workGuideEnum.getName();
            }
        }

        return null;
    }
}
